<template>
  <!--  v-bind="$attrs"-->
  <a-input
    :value="data?.supplierName"
    @click="openFn"
    :disabled="props.isAdd"
    placeholder="请选择"
  />
  <!--  <a-button type="primary" style="margin-top: 10px" v-if="props.isAdd&&isUpdate">添加人员</a-button>-->
  <SelectSupplierModal
    @register="registerModal"
    @success="handleSuccess"
    :mode="props.mode"
  ></SelectSupplierModal>
</template>

<script lang="ts" setup>
  import SelectSupplierModal from './SelectSupplierModal.vue';
  import { useModal } from '@/components/Modal';
  import { ref, computed, watch } from 'vue';
  import { useMessage } from '@/hooks/web/useMessage';
  import { useUserStore } from '@/store/modules/user';
  const userStore = useUserStore();
  import { useAttrs } from '@vben/hooks';
  const attrs = useAttrs();
  const data = computed(() => attrs.value.value);

  defineOptions({ name: 'SelectSupplierIndex' });
  const props = defineProps({
    mode: { type: String, default: 'single' },
    isAdd: { type: Boolean, default: false },
  });

  // , 'update:value'

  const emit = defineEmits(['change']);
  const [registerModal, { openModal }] = useModal();
  const { createMessage } = useMessage();

  const options = ref([]);

  watch(
    () => data.value,
    (r) => {
      console.log(r);
      // debugger
    },
  );

  function openFn() {
    // console.log("---props.mode222",props.mode)
    //console.log("--ids::",props.ids)
    openModal(true, {});
  }
  function handleSuccess(obj) {
    emit('change', obj);
  }
  function onLoadDataFn(ids) {
    // console.log("---接收数据:",ids)
  }
</script>

<style scoped></style>
